package com.cskaoyan.exception.admin;

import com.cskaoyan.bean.BaseRespVo;
import org.apache.shiro.authc.IncorrectCredentialsException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 类<code>Doc</code>用于：TODO
 *
 * @author Acher
 * @version 1.0
 * @date 2021-10-22
 */
@RestControllerAdvice
public class AdminExceptionControllerAdvice {

    @ExceptionHandler(IncorrectCredentialsException.class)
    public BaseRespVo incorrectCredentialsException() {
        return BaseRespVo.error("用户名或密码错误");
    }

    @ExceptionHandler(PasswordErrorException.class)
    public BaseRespVo passwordErrorException(PasswordErrorException ex) {
        return BaseRespVo.error(ex.getMessage());
    }

    @ExceptionHandler(AdminEmptyException.class)
    public BaseRespVo adminEmptyException(AdminEmptyException ex) {
        return BaseRespVo.error(ex.getMessage());
    }
}
